package jp.co.hcs.attendancemanagement.dialog.logic;

import java.sql.SQLException;

import jp.co.hcs.attendancemanagement.data.dao.EmployeeMasterDAO;
import jp.co.hcs.attendancemanagement.data.entity.EmployeeMaster;
import jp.co.hcs.attendancemanagement.logic.LogicBase;

/**
 * The Class GetEmployeeLogic.
 */
public class GetEmployeeLogic extends LogicBase implements GetEmployee {

  /** The employee master dao. */
  private EmployeeMasterDAO employeeMasterDAO;

  /*
   * (non-Javadoc)
   * 
   * @see jp.co.hcs.attendancemanagement.dialog.logic.IGetEmployeeLogic#getEmployeeById
   * (java.lang.String)
   */
  public EmployeeMaster getEmployeeById(String employeeId) throws SQLException {
    return getEmployeeMasterDAO().selectEmployeeMasterByPrimaryKey(employeeId);
  }

  /**
   * Gets the employee master dao.
   * 
   * @return the employee master dao
   */
  public EmployeeMasterDAO getEmployeeMasterDAO() {
    if (employeeMasterDAO == null) {
      employeeMasterDAO = daoFactory.getEmployeeMasterDAO();
    }

    return employeeMasterDAO;
  }

  /*
   * (non-Javadoc)
   * 
   * @see jp.co.hcs.attendancemanagement.dialog.logic.IGetEmployeeLogic# setEmployeeMasterDAO
   * (jp.co.hcs.attendancemanagement.data.dao.EmployeeMasterDAO)
   */
  @Override
  public void setEmployeeMasterDAO(EmployeeMasterDAO employeeMasterDAO) {
    this.employeeMasterDAO = employeeMasterDAO;
  }

}
